import logging

from pylons import request, response, session, tmpl_context as c, url
from pylons.controllers.util import abort, redirect

from clustermanager.lib.base import BaseController, render

log = logging.getLogger(__name__)

class DeployController(BaseController):

    def index(self):
        # Return a rendered template
        return render('/deploy/default.mako')
        # or, return a response

    def subversion(self):
        c.svnaddr='http://192.168.3.5/svn/scm/neo/deploy/zoshow'
        import pysvn
        def get_login( realm, username, may_save ):
            return True, 'neo', '123456', True

        client = pysvn.Client()
        client.callback_get_login = get_login
        #client.callback_get_login = lambda realm, username, may_save:(True, "myusername", "mypasswd", True)
        entry_list = client.ls(c.svnaddr, recurse=False)
        for entry in entry_list:
            c.entry_list = entry
        print(c.entry_list)
        return render('/deploy/subversion.mako')

